<template>
    <div class="sider">
        <el-row class="tac">
            <el-col :span="12">
                <el-menu
                default-active="3-1"
                class="el-menu-vertical-demo"
                @open="handleOpen"
                @close="handleClose"
                background-color="#545c64"
                text-color="#fff"
                active-text-color="#ffd04b">
                    <el-submenu index="1">
                        <template slot="title">
                            <i class="el-icon-location"></i>
                            <span>导航一</span>
                        </template>                      
                        <el-menu-item index="1-1">选项1</el-menu-item>
                        <el-menu-item index="1-2">选项2</el-menu-item>
                            
                        <el-submenu index="1-4">
                            <template slot="title">选项4</template>
                            <el-menu-item index="1-4-1">选项1</el-menu-item>
                        </el-submenu>
                    </el-submenu>
                    <el-menu-item index="2">
                        <i class="el-icon-menu"></i>
                        <span slot="title">导航二</span>
                    </el-menu-item>

                    <el-submenu index="3">
                        <template slot="title">
                            <i class="el-icon-user"></i>
                            <span>用户管理</span>
                        </template>                      
                        <el-menu-item index="3-1" @click="changeSubMenu('/user/list')">用户列表</el-menu-item>
                        <el-menu-item index="3-2" @click="changeSubMenu('/user/role')">角色列表</el-menu-item>
                        <el-menu-item index="3-3" @click="changeSubMenu('/user/viplist')">会员设置</el-menu-item>                        
                    </el-submenu>


                    <el-submenu index="4">
                        <template slot="title">
                            <i class="el-icon-document"></i>
                            <span>文章管理</span>
                        </template>                      
                        <el-menu-item index="4-1" @click="changeSubMenu('/article/index')">文章列表</el-menu-item>
                        <el-menu-item index="4-2" @click="changeSubMenu('/article/category')">分类管理</el-menu-item>
                        <el-menu-item index="4-3" @click="changeSubMenu('/article/tag')">标签管理</el-menu-item>
                        <el-menu-item index="4-4" @click="changeSubMenu('/article/comment')">评论管理</el-menu-item>                        
                    </el-submenu>

                    <el-submenu index="5">
                        <template slot="title">
                            <i class="el-icon-report"></i>
                            <span>报表管理</span>
                        </template>                      
                        <el-menu-item index="5-1" @click="changeSubMenu('/report/import')">报表导入</el-menu-item>
                        <el-menu-item index="5-2" @click="changeSubMenu('/report/export')">报表导出</el-menu-item>
                        <el-menu-item index="5-3" @click="changeSubMenu('/report/about')">其它</el-menu-item>                        
                    </el-submenu>

                    



                    <el-menu-item index="8">
                        <i class="el-icon-setting"></i>
                        <span slot="title">系统设置</span>
                    </el-menu-item>
                </el-menu>
            </el-col>
        </el-row>
    
    </div>
</template>

<script>
  export default {


    methods: {
        handleOpen(key, keyPath) {
            console.log(key, keyPath);
        },
        handleClose(key, keyPath) {
            console.log(key, keyPath);
        },

        changeSubMenu(val){
            let _this = this;
            let path = '/admin'+val;
            if(_this.$route.path === path){
                return;
            }
            _this.$router.push(path);
            
        },
    },


  }
</script>

<style>
    .sider{
        height:auto;
    }
    .el-col-12 {
        width:100%;
        float:none;
    }
    .el-menu-item, .el-submenu__title {
        height: 50px;
        line-height: 50px;
    }
    .el-submenu .el-menu-item {
        min-width: 0px;
        padding-left: 60px!important;
        height:42px;
    }
    
</style>